import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/controllers/sports/motion_end/logic.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/tools/color_const.dart';
import 'package:share_fit/generated/locales.g.dart';

class SharedEndDialog extends Dialog {

  final logic = Get.put(MotionEndLogic());

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        child: Material(
          type: MaterialType.transparency,
          child: Center(
            child: Container(
              width: 879.w,
              height: 707.h,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(10)
              ),
              child: Column(
                children: [
                  Container(
                    margin: EdgeInsets.only(top: 58.h),
                    alignment: Alignment.topCenter,
                    child: Text(LocaleKeys.sports_shared_end.ts, style: TextStyle(color: Colors.black, fontSize: 52.sp),),
                  ),
                  Container(
                    margin: EdgeInsets.only(top: 61.h),
                    alignment: Alignment.topCenter,
                    child:Image.asset('assets/images/device/device_dialog_success.png', width: 213.w, height: 213.h),
                  ),
                  Container(
                    height: 130.h,
                    width: 1.sw,
                    margin: EdgeInsets.fromLTRB(42.w, 99.h, 42.w, 0.h),
                    child: ElevatedButton(
                      onPressed: () {
                        // Get.offAllNamed('/main');
                        // Get.until((route) => Get.currentRoute=='/main');
                        logic.goToSportsPage();
                      },
                      style: ButtonStyle(
                          backgroundColor: MaterialStateProperty.all(ColorConst.activeColor),
                          shape: MaterialStateProperty.all(RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)
                          ))
                      ),
                      child: Text(LocaleKeys.sports_back_main.ts, style: TextStyle(fontSize: 40.sp, color: Colors.white, ),),
                    ),),
                ],
              ),
            )
          ),
        ),
        onTap: () {
          Navigator.pop(context);
        }
    );
  }
}